function getCaptchaPhoto() {
    return axios.get('/common/captcha')
}

function checkCaptcha(inputCode) {
    return axios.get('/common/checkCaptcha?inputCode=' + inputCode)
}

/**
 * 获取当前时间
 * @returns {string}
 */
function getFormattedDate() {
    const today = new Date();
    const year = today.getFullYear();
    const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are zero-indexed
    const day = String(today.getDate()).padStart(2, '0');

    // Example format: YYYY-MM-DD HH:MM:SS
    return `${year}-${month}-${day}`;
}

function getUserInfo() {
    const userInfo = JSON.parse(localStorage.getItem("userInfo"))
    if (userInfo === null) {
        alert("信息缺失请重新登陆")
        window.location.href = '/easyban/index.html?message=NotLogin';
        return
    }
    return userInfo
}

function delPhotoApi(photo) {
    return axios.delete('/common/photo', {
        params: {photo}
    });
}

function downloadApi(photo) {
    return axios.get(`/common/download?name=${photo}`)
}

function cleanWrongPhotoApi() {
    return axios.delete('/common/clean')
}

function goToSelfUrl(url) {
    window.open(url, '_self');
}

